#include "global.h"
#include <opencv2/features2d/features2d.hpp>
#include <opencv2/nonfree/nonfree.hpp>
#include "globalInit.h"
#include "Solve3D.h"


namespace markerAR
{
    
double r[3] = { -0.00219625, -0.00354483, -0.00602029 };

void globalInit(int imgWidth,int imgHeight,double focal)
{
    
	imgSize = new cv::Size(imgWidth, imgHeight);	
    track = new Tracking();
    initialzer = new Initializer();
    brief = new BRIEF(10,500);
    orb = new ORB(10);
	myorb = new ORB(10);
    orb_no = new ORB(10); 
    relocal = new Relocalisation();
    map = new Map();
	binaryMatcher = DescriptorMatcher::create("BruteForce-Hamming");
    KMatrix = new Eigen::Matrix3d();
    KMatrix->setIdentity();
    KMatrix->operator()(0, 0) = focal;
    KMatrix->operator()(1, 1) = focal;
    KMatrix->operator()(2, 2) = 1;
    KMatrix->operator()(0, 2) = (imgWidth - 1) / 2;
    KMatrix->operator()(1, 2) = (imgHeight - 1) / 2;
	last = new Keyframe();
	N.setZero();
	N(2) = 1;
	D = 0;
	scale = 0.125;
	K = new IntrinsicMatrix(*KMatrix);
	IntrinsicMatrix K2 = K->applyScale(scale);
    
}
    
}